<?php

namespace App\Utils;

class ResUtil
{

    const UNEXCEPTED_EXCEPTION = '服务器异常,请稍后重试';
    const NOT_DATA = '数据不存在';
    const LOGIN_FAIL = '登录失败';
    const WRONG_PARAMS = '参数错误';
    const PAGENATION = 10;
    const SAVE_FAIL = '保存失败';

    public static function error($msg = "", $code = 201, $data= []){
        return [
            'code' => $code,
            'data' => $data,
            'userMsg' => $msg,
            'zTime' => DateUtil::now()
        ];
    }

    public static function ok($data = [], $msg = 'SUCCESS', $code = 200)
    {
        return [
            'code' => $code,
            'data' => $data,
            'userMsg' => $msg,
            'zTime' => DateUtil::now()
        ];
    }
}
